﻿<UserControl x:Class="CAION2.Views.StigmasPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:resources="clr-namespace:CAION2.Properties"
             xmlns:viewModels="clr-namespace:CAION2.ViewModels"
             xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
             xmlns:mui="http://firstfloorsoftware.com/ModernUI"
             xmlns:controls="clr-namespace:CAION2.Controls">
    
    <UserControl.Resources>
        <viewModels:GameClassIconConverter x:Key="GameClassIconConverter" />
        <viewModels:InvertConverter x:Key="InvertConverter"/>
    </UserControl.Resources>

    <UserControl.DataContext>
        <viewModels:StigmasViewModel />
    </UserControl.DataContext>


    <Grid Style="{StaticResource ContentRoot}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="310" />
            <ColumnDefinition Width="410" />
            <ColumnDefinition MinWidth="310" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="60" />
            <RowDefinition Height="320" />
            <RowDefinition Height="40"/>
            <RowDefinition />
        </Grid.RowDefinitions>

        <StackPanel Grid.Column="2"
                Margin="{StaticResource HeaderMargin}"
                HorizontalAlignment="Right"
                VerticalAlignment="Top"
                Orientation="Horizontal">
            <mui:ModernButton Margin="0,0,10,0"
                            Command="{Binding LoadCharacterCommand}"
                            Content="{x:Static resources:Resources.Load}"
                            IconData="{StaticResource LoadIcon}"
                            ToolTip="{x:Static resources:Resources.Status_LoadCharacter}" />
            <mui:ModernButton Command="{Binding SaveCharacterCommand}"
                            Content="{x:Static resources:Resources.Save}"
                            IconData="{StaticResource SaveIcon}"
                            ToolTip="{x:Static resources:Resources.Status_SaveCharacter}" />
        </StackPanel>

        <ComboBox Grid.Row="0" 
                  Grid.Column="1"
                  Height="25"
                  Width="140"
                  Margin="0,0,50,0"
                  VerticalAlignment="Top"
                ItemsSource="{Binding GameClasses}"
                SelectedItem="{Binding CurrentCharacterClass, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <Image Width="22"
                            Height="22"
                            Margin="0,0,10,0"
                            Source="{Binding Converter={StaticResource GameClassIconConverter}}" />
                        <TextBlock VerticalAlignment="Center" Text="{Binding}" />
                    </StackPanel>

                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>

        <mui:ModernButton Grid.Row="0" 
                        Grid.Column="1"
                        Margin="0,3,80,0"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Top"
                        Command="{Binding ClearPlacesCommand}"
                        IconData="{StaticResource ClearIcon}"
                        ToolTip="{x:Static resources:Resources.Status_ClearPlaces}" />
 
        <xctk:IntegerUpDown Grid.Row="0" 
                        Grid.Column="1"
                        Width="45"
                        Height="25"
                        Margin="150,0,105,0"
                        HorizontalAlignment="Right"
                        VerticalAlignment="Top"
                        Maximum="{Binding MaxCharacterLevel}"
                        Minimum="10"
                        Value="{Binding CurrentCharacterLevel,
                                        Mode=TwoWay,
                                        UpdateSourceTrigger=PropertyChanged}"/>

        <StackPanel Grid.Column="1"
                    Grid.Row="0"
                    Orientation="Horizontal"
                    Margin="0,30,70,0"
                    HorizontalAlignment="Center">
            <RadioButton Content="{x:Static resources:Resources.Stigma_Asmo}" 
                         Margin="0,0,10,0" 
                         IsChecked="{Binding CurrentCharacterRace, Mode=TwoWay}"/>
            <RadioButton Content="{x:Static resources:Resources.Stigma_Elyos}" 
                         IsChecked="{Binding CurrentCharacterRace, Mode=OneWay, 
                                             Converter={StaticResource InvertConverter}}"/>
        </StackPanel>
        
        
        <Canvas Width="401" 
                Height="316"
                Grid.Row="1"
                Grid.Column="1"
                Visibility="{Binding PlacesVisible}">
            <Canvas.Background>
                <ImageBrush ImageSource="/CAION2;component/UI2/SHud.png" Stretch="None"/>
            </Canvas.Background>

            <controls:StigmaPlace Margin="20,17,0,0"
                                  DataContext="{Binding Places[0]}" >
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

            <controls:StigmaPlace Margin="112,17,0,0"
                                  DataContext="{Binding Places[1]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

            <controls:StigmaPlace Margin="20,108,0,0"
                                  DataContext="{Binding Places[2]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

            <controls:StigmaPlace Margin="112,108,0,0"
                                  DataContext="{Binding Places[3]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

            <controls:StigmaPlace Margin="20,199,0,0"
                                  DataContext="{Binding Places[4]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

            <controls:StigmaPlace Margin="112,199,0,0"
                                  DataContext="{Binding Places[5]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>
            
            <controls:StigmaPlace Margin="211,17,0,0"
                                  DataContext="{Binding Places[6]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

            <controls:StigmaPlace Margin="304,17,0,0"
                                  DataContext="{Binding Places[7]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

            <controls:StigmaPlace Margin="211,108,0,0"
                                  DataContext="{Binding Places[8]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

            <controls:StigmaPlace Margin="304,108,0,0"
                                  DataContext="{Binding Places[9]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

            <controls:StigmaPlace Margin="211,199,0,0"
                                  DataContext="{Binding Places[10]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

            <controls:StigmaPlace Margin="304,199,0,0"
                                  DataContext="{Binding Places[11]}">
                <controls:StigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding GetItemForPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:StigmaPlace.InputBindings>
            </controls:StigmaPlace>

        </Canvas>

        <TextBlock Grid.Row="2"
                   Grid.ColumnSpan="3" 
                   Grid.Column="0"
                   Margin="0,5,0,0"
                   HorizontalAlignment="Center"
                   FontSize="10"
                   Foreground="{DynamicResource ItemText}"
                   Text="{x:Static resources:Resources.Stigma_ClickTooltip}"
                   TextAlignment="Center"
                   Visibility="{Binding PlacesVisible}" />
        
        <Border Grid.Row="3"
                Grid.Column="1"
                BorderThickness="2"
                VerticalAlignment="Center"
                HorizontalAlignment="Center"
                Height="40"
                MaxWidth="390"
                BorderBrush="{DynamicResource Accent}">
            
            <StackPanel Orientation="Horizontal" 
                        HorizontalAlignment="Center"
                        Margin="10,0">
                <Image Source="/CAION2;component/UI2/CrystalShard.png"
                       Width="16"
                       Height="16"
                       VerticalAlignment="Center"
                       Margin="0,0,5,0"/>

                <TextBlock Text="{Binding CrystalShardSum, StringFormat={}{0:N0}, ConverterCulture=Ru-ru}"
                           TextWrapping="Wrap"
                           VerticalAlignment="Center"/>

                <Image Source="/CAION2;component/UI2/AbyssPoints.png"
                       Width="16"
                       Height="16"
                       VerticalAlignment="Center"
                       Margin="20,0,5,0"/>

                <TextBlock Text="{Binding AbyssPointSum, StringFormat={}{0:N0}, ConverterCulture=Ru-ru}"
                           VerticalAlignment="Center"/>

            </StackPanel>
        </Border>

        
        <Canvas Grid.Column="0"
                Grid.Row="1"
                Width="310"
                Height="260"
                Visibility="{Binding PlacesVisible}">
            <Canvas.Background>
                <ImageBrush ImageSource="/CAION2;component/UI2/Stigma_Tree.png" Stretch="None"/>
            </Canvas.Background>

            <controls:EnhantStigmaPlace Margin="5,5,0,0"
                                  DataContext="{Binding EnhantDefPlaces[5]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="5,109,0,0"
                                  DataContext="{Binding EnhantDefPlaces[6]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="5,213,0,0"
                                  DataContext="{Binding EnhantDefPlaces[7]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="90,57,0,0"
                                  DataContext="{Binding EnhantDefPlaces[3]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="90,213,0,0"
                                  DataContext="{Binding EnhantDefPlaces[4]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="175,161,0,0"
                                  DataContext="{Binding EnhantDefPlaces[2]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="175,109,0,0"
                                  DataContext="{Binding EnhantDefPlaces[1]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="260,135,0,0"
                                  DataContext="{Binding EnhantDefPlaces[0]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

        </Canvas>

        <Canvas Grid.Column="2"
                Grid.Row="1"
                Width="310"
                Height="260"
                Visibility="{Binding PlacesVisible}">
            <Canvas.Background>
                <ImageBrush ImageSource="/CAION2;component/UI2/Stigma_Tree.png" Stretch="None"/>
            </Canvas.Background>

            <controls:EnhantStigmaPlace Margin="5,5,0,0"
                                  DataContext="{Binding EnhantAttPlaces[5]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="5,109,0,0"
                                  DataContext="{Binding EnhantAttPlaces[6]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="5,213,0,0"
                                  DataContext="{Binding EnhantAttPlaces[7]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="90,57,0,0"
                                  DataContext="{Binding EnhantAttPlaces[3]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="90,213,0,0"
                                  DataContext="{Binding EnhantAttPlaces[4]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="175,161,0,0"
                                  DataContext="{Binding EnhantAttPlaces[2]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="175,109,0,0"
                                  DataContext="{Binding EnhantAttPlaces[1]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

            <controls:EnhantStigmaPlace Margin="260,135,0,0"
                                  DataContext="{Binding EnhantAttPlaces[0]}" >
                <controls:EnhantStigmaPlace.InputBindings>
                    <MouseBinding Command="{Binding AddEnhantedStigmaToPlaceCommand}" Gesture="LeftDoubleClick" />
                </controls:EnhantStigmaPlace.InputBindings>
            </controls:EnhantStigmaPlace>

        </Canvas>

    </Grid>

    
    
</UserControl>
